package com.sean.learnelasticsearch.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.elc.ElasticsearchConfiguration;

/**
 * ES 客户端配置
 *
 * @author 林思瀚 (linsihan@cndatacom.com)
 * @date 2023-09-21 10:58:02
 */
@Configuration
public class MyESClientConfig extends ElasticsearchConfiguration {
    @Value("${spring.elasticsearch.uris}")
    private String esUrl;

    @Override
    public ClientConfiguration clientConfiguration() {
        return ClientConfiguration.builder()
                .connectedTo(esUrl)
                .build();
    }
}
